<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>福州ROBO信奥种子选手抽奖专用</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(90deg,brown,white,orange);
            text-align: center;
            font-size: 30px;
        }
        
        h2 {
            color: #333;
        }
        
        button {
            background-color: #5cb85c; /* Green */
            border: none;
            color: white;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }
        
        #result {
            font-size: 1.5em;
            margin-top: 20px;
        }
        img{
            width:100px;
            height: 100px;
            border: solid 10px rgb(211, 76, 76);
        }
        .button_box{
            margin: 10px auto;
        }
        #classSelect,
        #oknum
        {
            width:100px;
            height:30px;
            text-align: center;
        }
        #oknum{
            border: red 2px dashed;
        }
    </style>
</head>
<body>
    <marquee behavior="" direction="left">幸运大抽奖：</marquee>
    <div style="text-align:center;"> 
        <a href="抽奖1.html" style="text-decoration:none;color:black;font-size:18px;">滚动牌</a>
        <a href="抽奖2.html" style="text-decoration:none;color:black;font-size:18px;">幸运大转盘</a>
        <a href="抽奖3.html" style="text-decoration:none;color:black;font-size:18px;">翻牌子</a>
        <a href="抽奖4.html" style="text-decoration:none;color:black;font-size:18px;">新玩法</a>
    </div>
    <span class="js-cursor-container"></span>
    <h2>幸运大转盘</h2>
    <div>
        <select id="classSelect">
            <option value="classA">世欧校区</option>
            <option value="classB">东街口校区</option>
            <option value="classC">五四路校区</option>
            <option value="classD">群升校区</option>
            <option value="classE">明腾校区</option>
            <option value="classF">东街口校区F</option>
        </select>
    </div>
    <div class="button_box">
        <button class="btn" onclick="start()" accesskey="s">开始(<U>S</U>)</button>
        <button class="btn" onclick="ok()" accesskey="o">停止(<U>O</U>)</button>
    </div> 
    <div class="result_box"><input type="text" id="oknum" name="oknum" value="幸运儿" /></div>
    <br>
    <img src="images/抽奖.gif" alt="" id="student">
    <script src="jquery.min.js"></script>
    <script src="heart.js"></script>
    <script src="star.js"></script>
    <script src="spider.js"></script>
    <!--光标特效仙女棒-->
    <script src="https://blog-static.cnblogs.com/files/axqa/fairyDustCursor.js"></script>
    <!--光标之泡泡-->
    <script src="https://blog-static.cnblogs.com/files/axqa/bubbleCursor.js"></script>
    <!--笑脸-->
    <!-- <script src="https://blog-static.cnblogs.com/files/axqa/emojiCursor.js"></script> -->
    <!--雪花-->
    <script src="https://blog-static.cnblogs.com/files/axqa/snowflakeCursor.js"></script>
    <!-- 点击后出现烟花效果 -->
    <script src="https://blog-static.cnblogs.com/files/axqa/cursor-effects.js"></script>
    <script src="studentlist.js"></script>
    <script>
        
        var timer;
        var num;
        var studentList;
        var isok=0;
        var last;
        function change(){ 
            var n=GetRnd(0,num-1);
            document.getElementById("oknum").value = studentList[n];    
            document.getElementById("student").setAttribute("src","images/"+studentList[n]+".png");
        }  
        function start(){     
            clearInterval(timer); 
            const selectedClass = document.getElementById('classSelect').value;
            if(selectedClass != last) {isok=0;last=selectedClass;}
            if(isok==0 || studentList.length<1){
                studentList = students[selectedClass];
            }
            num=studentList.length;   
            timer = setInterval('change()',10); //随机数据变换速度，越小变换的越快     
        }  
        function ok(){  
            isok=1;   
            clearInterval(timer);     
            //以下代码表示获得奖的，不能再获奖了。  重置刷新页面即可。
            var rep=document.getElementById("oknum").value;
            studentList = studentList.filter(function(item){
                return item !==rep;
            }) 
            // console.log(studentList);  
            num = studentList.length-1;    
        }     
        function GetRnd(min,max){     
            return parseInt(Math.random()*(max-min+1));     
        }  
    </script>
</body>
</html>